package com.dsp.week12.conf;

import com.dsp.week12.model.MessageExt;
import io.github.majusko.pulsar.producer.ProducerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class PulsarConfig {

    @Value("${my-topic.test}")
    public String testTopic;
    @Value("${my-topic.msg}")
    public String msgTopic;
    @Value("${my-topic.obj}")
    public String objTopic;

    @Bean
    public ProducerFactory producerFactory() {
        return new ProducerFactory()
                .addProducer(testTopic, String.class)
                .addProducer(msgTopic, String.class)
                .addProducer(objTopic, MessageExt.class);
    }


}
